<?php
/**
 * cherylib
 * Unit-test your PHP code.
 * @author Aaron Collegeman aaroncollegeman.com
 * @version 1.0.1 (beta): $Id$
 *
 * Copyright (C)2008 Collegeman.net, LLC.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
 */

// ----------------------------------------------------------------------------
// Don't touch anything in this file.  That way when there's an update, you
// can just overwrite this file with the new one.  Go ahead, we warned you!
// ----------------------------------------------------------------------------

error_reporting(E_ALL);
ini_set('display_errors', true);

class cyTest {

	static function assertEqual($known, $test) {
		if ($known !== $test)
			throw new UnitTestException("Not equivalent: found [$test], expecting [$known].");
		else
			return true;
	}
	
	static function assertNotEqual($known, $test) {
		if ($known === $test)
			throw new UnitTestException("Equivalent (but shouldn't be): $test.");
		else
			return true;
	}

	static function assertTrue($boolean) {
		if (!$boolean)
			throw new UnitTestException("Not true: ".$boolean);	
	}
	
	static function assertFalse($boolean) {
		if ($boolean)
			throw new UnitTestException("Not false: ".$boolean);	
	}
	
}

class UnitTestException extends Exception {}

function assert_equal($known, $test) {
	return cyTest::assertEqual($known, $test);
}

function assert_not_equal($known, $test) {
	return cyTest::assertNotEqual($known, $test);	
}

function assert_true($boolean) {
	return cyTest::assertTrue($boolean);	
}

function assert_false($boolean) {
	return cyTest::assertFalse($boolean);	
}